
Part 5:
Shaders are isolated programs that run in parallel on GPU, executing sections of the graphics
pipeline, taking in an input, and outputting a single 4-dimensional vector. We know that vertex
shaders are shaders that apply transforms to vertices by modifying their geometric properties like
position and normal vectors, writing the final position of the vertex to gl_Position in addition to
writing varyings for use in the fragment shader. And the fragment shaders are what we get after
rasterization, which these shaders process. Fragment shaders generally take in geometric
attributes of the fragment calculated by the vertex shader to compute and write color into
out_color.
The Blinn-Phong shading model is a lighting model used in computer graphics to simulate how
light interacts with surfaces. It consists of three main components. Firstly, ambient Light
provides a constant color contribution to the surface, representing overall scene lighting. Diffuse
Reflection models light scattering on rough surfaces, determining the base color of objects based
on their orientation to light sources. Specular Highlights simulates shiny surfaces by calculating
bright highlights where light reflects off the surface, using a halfway vector between the light
direction and view direction. And by combining these components with material properties like
ambient, diffuse, and specular colors, the Blinn-Phong model creates realistic lighting effects in
real-time rendering applications like games and simulations.